﻿using System.Collections.Generic;
using ApplicationGenerator.CommonModule;

namespace GUserInterface
{
    public partial class ErrorList : GToolbox
    {
        public ErrorList()
        {
            InitializeComponent();
            InitializeComponent_Custom();
        }

        public void InitializeComponent_Custom()
        {
            this.TabText = "Error List";
        }

        public void ClearGrid()
        {
            dataGridView1.Rows.Clear();
        } 

        public void FillErrorList( List<ErrorEntity> errList )
        {
            int counter = 0;
            dataGridView1.Rows.Clear();

            foreach (ErrorEntity error in errList)
            {
                foreach (string errorString in error.ErrorStrings)
                {
                    object[] row = { counter.ToString(), "[" + error.Row + "," + error.Col + "] " + error.ControlName, errorString };
                    dataGridView1.Rows.Add(row);
                    counter++;
                }
            }
            dataGridView1.Refresh();
        }
    }

    
}
